package com.example.day11_7_11_3.base;


import java.util.ArrayList;

public abstract class BasePresenter<V extends BaseView> {
    public V mView;
    private ArrayList<BaseModel> mModels = new ArrayList<>();

    public BasePresenter(){
        initModel();
    }

    public abstract void initModel();

    public  void bindView(V view) {
        mView = view;
    }


    public void onDestory() {
        if (mModels.size() >0){
            for (int i = 0; i < mModels.size(); i++) {
                BaseModel model = mModels.get(i);
                model.onDestroy();
            }
        }
        mView = null;
    }

    public void addModel(BaseModel model){
        mModels.add(model);
    }

    public abstract void getData();
}
